<?php
/***************************************************************
 *  Copyright notice
 *
 *  (c) 2013 WOLTER, Christoph <typo3@chrinet.de>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
 *  free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  The GNU General Public License can be found at
 *  http://www.gnu.org/copyleft/gpl.html.
 *
 *  This script is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/


/**
 * AutoConfiguration-Hook for RealURL
 *
 * @author HOBSTERDRE, Romain <romain@hobsty.com>
 * @package TYPO3
 * @subpackage tx_lifein35
 */
class Tx_Lifein35_Hooks_RealUrlAutoConfiguration {

	/**
	 * Generates additional RealURL configuration and merges it with provided configuration
	 *
	 * @param       array $params Default configuration
	 * @return      array Updated configuration
	 */
	public function addImagesConfig($params) {

		// $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'] = array(
    // 'fileName' => array (
            // 'defaultToHTMLsuffixOnPrev' => 0,
            // 'acceptHTMLsuffix' => 1,
            // 'index' => array(
                    // 'feed.rss' => array(
                            // 'keyValues' => array(
                                    // 'type' => 9818,
                            // )
                    // ),
            // )
    // )
// );
	
		return array_merge_recursive($params['config'], array(
				'fixedPostVars' => array(
					'_DEFAULT' => array(
							array(
								'GETvar' => 'tx_lifein35_list[@widget_0][currentPage]',
							),
						array(
							'GETvar' => 'tx_lifein35_list[controller]',
							'valueMap' => array(
								'image' => 'Image',
							),
							'noMatch' => 'bypass',
						),
						array(
							'GETvar' => 'tx_lifein35_list[action]',
							'valueMap' => array(
								'show' => 'show',
								'list' => 'list',
							),
							'noMatch' => 'bypass',
						),
						array(
							'GETvar' => 'tx_lifein35_list[image]',
							'lookUpTable' => array (
								'table' => 'tx_lifein35_domain_model_image',
								'id_field' => 'uid',
								'alias_field' => 'title',
								'addWhereClause' => ' AND NOT deleted',
								'useUniqueCache' => '1',
								'useUniqueCache_conf' => array (
									'strtolower' => '1',
									'spaceCharacter' => '-',
								),
							),
						),
					),
				),
				'fileName' => array (
						'defaultToHTMLsuffixOnPrev' => 0,
						'acceptHTMLsuffix' => 1,
						'index' => array(
								'rss.xml' => array(
										'keyValues' => array(
												'type' => 123,
										)
								),
								'map.kml' => array(
										'keyValues' => array(
												'type' => 234,
										)
								),
								'list.txt' => array(
										'keyValues' => array(
												'type' => 345,
										)
								),
						)
				),
				// 'postVarSets' => array(
					// '_DEFAULT' => array(
						// 'page' => array(
							// array(
								// 'GETvar' => 'tx_lifein35_list[@widget_0][currentPage]',
							// ),
						// )
					// )
				// )
			)
		);
	}
}